\begin{tikzpicture}[>=Stealth, scale=0.6]
    \draw [->] (-3, 0) -- (3, 0);

    \draw (0, 0) node[below] {$O$};
    \foreach \x in {-2, ..., 2} {
        \draw (\x, 0.2) -- (\x, 0);
    }

    \pic [transform shape] {interval={start=-2, stop=2, height=0.5}};
    \foreach \x in {-2, 2} {
        \draw [fill=white] (\x, 0) circle(0.1) node [below=0.2em] {$\x$};
    }
\end{tikzpicture}

